package com.demo.rational_;

public class Secondweek_demo {
    public static void main(String[] args) {
        Course course1=new Course(1001,2,48,0,"Java程序设计");
        Course course2=new Course(2002,2,48,0,"C语言程序设计");
        Student student1=new Student(23015122,21,"男","刘佳荣","信息科学与技术学院");
        Student student2=new Student(23015223,21,"女","李四","信息科学与技术学院");

        course1.Ifbelong(student1.getStudent_academy());
        course2.getStudent_academy(student1.getSex(), student2.getSex());
        course1.Num(student1.getStudent_academy());
    }
}

class Student{
    private int student_id;//学生的学号
    private int student_age;//学生的年龄
    private String sex;//学生的性别
    private String student_name;//学生的姓名
    private String student_academy;//学生所在的学院

    public Student(int student_id, int student_age, String sex, String student_name, String student_academy) {
        this.student_id = student_id;
        this.student_age = student_age;
        this.sex = sex;
        this.student_name = student_name;
        this.student_academy = student_academy;
    }

    public int getStudent_id() {
        return student_id;
    }

    public int getStudent_age() {
        return student_age;
    }

    public String getSex() {
        return sex;
    }

    public String getStudent_name() {
        return student_name;
    }

    public String getStudent_academy() {
        return student_academy;
    }
}


 class Course{
    private int course_id;//课程的代码
    private int course_credit;//课程的学分
    private int course_time;//课程的总时常（一小时为一单位）
    private int course_num;//课程的人数
    private String course_name;//课程的名字

    public Course(int course_id, int course_credit, int course_time, int course_num, String course_name) {
        this.course_id = course_id;
        this.course_credit = course_credit;
        this.course_time = course_time;
        this.course_num = course_num;
        this.course_name = course_name;
    }

     public int getCourse_id() {
         return course_id;
     }

     public int getCourse_credit() {
         return course_credit;
     }

     public int getCourse_time() {
         return course_time;
     }

     public int getCourse_num() {
         return course_num;
     }

     public String getCourse_name() {
         return course_name;
     }
     public void getStudent_academy(String sex1,String sex2) {
         int sex_b=1;int sex_g=1;
         if (sex1.equals("男")&&sex2.equals("男")){
             sex_b=2;
             System.out.println("有"+sex_b+"名同学均为男性");
         }
         else if(sex1.equals("女")&&sex2.equals("女")) {
             sex_g=0;
             System.out.println("有"+sex_b+"名同学均为女性");
         }
         else{
             System.out.println("有"+sex_g+"名同学为女性,有"+sex_b+"名同学为男性");
         }
     }

     public void  Ifbelong(String student_academy) {
         if (student_academy.equals("信息科学与技术学院")) {
             System.out.println("学院查询正确");
         } else {
             System.out.println("学院查询错误，请稍等");
         }
     }
     public void Num(String student){
        if (student.equals("信息科学与技术学院"))
        {
            System.out.println("目前的课程为"+course_name);
        }
        else {
            System.out.println("查询错误");
        }
     }
 }

